<!DOCTYPE html>
<html>
<head>
<title>jsonTest</title>
<meta charset="utf-8" />
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<script type="text/javascript">
	function requestJson() {
		$.ajax({
			url : "/mobile/requestJson",
			type : "POST",
			data : '{"id":2,"name":"lily","address":"长江村"}',
			dataType : "json",
			contentType : "application/json",
			success : function(data) {
				alert(data);
				console.log(data);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert(textStatus);
			}
		});
	}

	function responseJson() {
		$.ajax({
			url : "/mobile/responseJson",
			type : "POST",
			data : {
				"id" : 2,
				"name" : "lily",
				"address" : "长江村"
			},
			dataType : "json",
			success : function(data) {
				alert(data);
				console.log(data);
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert(textStatus);
			}
		});

	}
</script>
</head>

<body>

	<button onclick="requestJson()">请求json,返回json</button>
	<button onclick="responseJson()">请求key/value,返回json</button>
</body>
</html>
